<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js练习</title>
</head>
<body>

</body>
<script>
    console.log("John".constructor);                // 返回函数 String()  { [native code] }
    console.log((3.14).constructor);                   // 返回函数 Number()  { [native code] }
    console.log(false.constructor);                    // 返回函数 Boolean() { [native code] }
    console.log([1,2,3,4].constructor);                // 返回函数 Array()   { [native code] }
    console.log({name:'John', age:34}.constructor);    // 返回函数 Object()  { [native code] }
    console.log(new Date().constructor);               // 返回函数 Date()    { [native code] }
    console.log(function () {}.constructor);           // 返回函数 Function(){ [native code] }

    function myObj(name,age){
        var obj = {
            name : name,
            age :age
        }
        return obj;
    }

    var lhr = new myObj('lhr',25);
    console.log(lhr.name);
    console.log(lhr.age);


    var myArr = ['a','b','c'];
    console.log(myArr);

    lhr = {
        g : 1,
        h : '23'
    }
    console.log(lhr);
</script>

</html>